# ifndef MESHSETMGR_H
# define MESHSETMGR_H

#include <vector>
#include "utilities.h"
#include "MeshSet.h"

using namespace std;

class MeshSetMgr
{
  vector<MeshSet *> vMeshSet;
  
  public:
    
	MeshSetMgr(){ vMeshSet.clear();} //constructor 

	~MeshSetMgr() // destructor
	{
      for ( int i = 0; i < count(); i++ )
	  {
        if ( NULL != vMeshSet[i] ) delete vMeshSet[i];
	  }
	}  

    int count() const { return vMeshSet.size(); }

	void CreateSet( unsigned int id, unsigned int type )
	{ 
	  MeshSet * set = new MeshSet(id, type);
	  if ( NULL != set )
	  {
        vMeshSet.push_back(set);
	  }
	  else
	  {
	    Error("Error in  MeshSetMgr::CreateSet");
	  }
	}

	MeshSet* GetMeshSetPtr( unsigned int id )
	{
      for ( int i = 0; i < count(); i++ )
	  {
        if ( vMeshSet[i]->GetID() == id ) return vMeshSet[i];
	  }
      return NULL;
	}

};


# endif // MESHSETMGR_H